package com.zj.project.viewmodel

import android.app.Application
import androidx.annotation.NonNull
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingSource
import androidx.paging.cachedIn
import com.zj.project.bean.ArticleBean
import com.zj.project.bean.ArticleItemBean
import com.zj.project.common.base.BaseDataSource
import com.zj.project.common.base.BaseViewModel
import com.zj.project.common.expand.printfLog
import com.zj.project.common.expand.subscribe
import kotlinx.coroutines.launch
import java.sql.DriverManager

class PagingViewModel(@NonNull application: Application) : BaseViewModel(application) {

    fun getData() = Pager(PagingConfig(pageSize = 80, prefetchDistance = 10,initialLoadSize = 40)) {
        BaseDataSource<ArticleItemBean>(api)
    }.flow.cachedIn(viewModelScope)


}